package com.inspect.util;

import java.util.HashMap;
import java.util.Set;



public class LoadAppXml {
	public static void main(String[] args) {
		LoadAppXml load = LoadAppXml.getInstance();
		HashMap<String ,String> config = load.getConfig();
		Set<String> set = config.keySet();
		for (String s : set) {
			System.out.println(s + ":" + config.get(s));
		}
		
	}
	
	private static HashMap<String, String> konviewdb = null;
	private static HashMap<String, String> inspect = null;
	public static HashMap<String, String> confighm = new HashMap<String, String>();

	private static boolean init_mark = false;
	private static LoadAppXml instance = null;
	
	public static synchronized LoadAppXml getInstance()
	{
		if(instance == null)
		{
			instance = new  LoadAppXml();
			instance.init();
			return instance;
		}
		else
		{
			return instance;
		}
	}
	
	public void init() {
		if(init_mark)
		{
			return ;
		}
		UniformConfig.getInstance();
//		
		konviewdb = UniformConfig.getCommonConfigUnit("KON_VIEW_DB");
		inspect = UniformConfig.getExtConfigUnit("inspect");

		if (konviewdb != null && inspect != null ) {
			confighm.putAll(konviewdb);
			confighm.putAll(inspect);
			init_mark = true;
		}
	}

	public HashMap<String, String> getConfig() {
		return confighm;
	}
}
